<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<c:if test="${empty pass}">
    <c:redirect url="dvd_manager"></c:redirect>
</c:if>

<script type="text/javascript" src = "rsrc/js/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src = "rsrc/js/jquery.validationEngine.js"></script>

<script>
    $(document).ready(function(){
        $('#dvd_form').validationEngine('attach');
        $('#cancelDVDForm').click(function(){           
           $('#dvd_form').validationEngine('hideAll');
           $('#dvd_form').validationEngine('detach');
        });
    });
</script>
<div class="separator"></div>
<div id="dvd_part">
    <c:if test="${!empty book}" >
        <p class="page_label">Add New DVD</p>
    </c:if>
    <c:if test="${empty book}" >
        <p class="page_label">Add New DVD</p>
    </c:if>
  
    <form id="dvd_form" action="add_dvd_action" method="post" >
        <table id="dvd_form_table">
            <tr>
                <td class="label" align="left">DVD Title</td>
                <td align="left"><input type='text' <c:if test="${!empty dvd}"> value="${dvd.title}" </c:if> name='dvdTitle' id='dvdTitle' class="validate[required,custom[onlyLetterSp]] input_text" title=""/>*</td>
            </tr>                    
            <tr>
                <td class="label" align="left">Genre:</td>
                <td align="left"><input type='text' <c:if test="${!empty dvd}"> value="${dvd.genre}" </c:if> name='genre' id='category' class="validate[required,custom[onlyLetterSp]] input_text" title=""/>*</td>
            </tr>
            <tr>
                <td class="label" align="left">Price:</td>
                <td align="left"><input type='text' <c:if test="${!empty dvd}"> value="${dvd.price}" </c:if> name='dvdPrice' id = 'dvdPrice' class="validate[required, custom[number]] input_text" title=""/>*</td>
            </tr>
            <tr>
                <td class="label" align="left">Release Date</td>
                <td align="left"><input type='text' <c:if test="${!empty dvd}"> value="${dvd.releaseDate}" </c:if> name='releaseDate' id = 'releaseDate' class="validate[required,custom[date],future[NOW]] input_text" title=""/>*</td>
            </tr>
            <tr>
                <td class="label" align="left">Number of Discs</td>
                <td align="left"><input type='text' <c:if test="${!empty dvd}"> value="${dvd.numDiscs}" </c:if> name='numDiscs' id = 'numDics' class="validate[required, custom[onlyNumberSp]] input_text" title=""/>*</td>
            </tr>
            <tr>
                <td class="label" align="left">Synopsis</td>
                <td align="left"><textarea cols="45" rows="5" name="synopsis" id="synopsis" class="validate[required] input_text" title=""><c:if test="${!empty dvd}"> ${dvd.synopsis} </c:if></textarea>*</td>
            </tr>
            <tr>
                <td align="left"></td><td align = "left"><input id='formDVDButton' type='submit' class='gb' value='Submit' name='formDVDButton' /><input id='cancelDVDForm' type='button' class='gb' value='Cancel' name='cancelDVDForm' /></td>
            </tr>            
        </table>
        <span class="label">Fields with * are required</span>
        <c:if test="${!empty dvd}"> <input type="hidden" name="b" id="b" value="${dvd.productCrypt}"/> </c:if>
        <input type="hidden" name="formType" id="formType" value="${formType}"/>
    </form>
</div>